home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
me_cd25.zip
/
MUTT2.ZIP
/
DELBUF.MUT
< prev
next >
Wrap
Text File
|
1992-11-09
|
1KB
|
41 lines
;; delbuf.mut : Dispose of a buffer, by name.
;; Default is current buffer.
;; If a window is displaying the buffer to be deleted, delete that
;; window.
;; C Durland Public Domain
(include me2.h)
(defun
MAIN { (bind-to-key "delete-buffer" "C-xk") }
delete-buffer
{
(string name)(int j n buf-id)
(name (complete CC_BUF "Delete buffer: "))
(if (== name "") (buf-id (current-buffer)) ;; use the default
(if (== -2 (buf-id (attached-buffer name)))
{ (msg '"' name '" is not a buffer.')(done) }))
;; Ask before we delete a modified buffer we care about
(if (and
(== BFModified ;; Check to see if we care about this buffer
(bit-and (buffer-flags buf-id) (bit-or BFModified BFNoCare)))
(not (yesno (buffer-name buf-id) " has changed. Delete anyway")))
(done)) ;; They don't want to delete it
(if (arg-flag)
{
;; remove all windows displaying buffer to be deleted
;; (unless its the only one left).
(n 0)
(while (and (< n (windows))(> (windows) 1))
{
(if (== buf-id (attached-buffer n)) { (free-window n) (continue) } )
(+= n 1)
})
})
(free-buffer buf-id) ;; Kiss that sucka goodbye
}
)